package com.forezp.configclient.springboot2Rabbit;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @version V1.0  </br>
 * @ClassName HelloSender1 </br>
 * @Description TODO  </br>
 * @Author tonywang</br>
 * @DATE 11/26/2018 10:26 AM</br>
 */
@Component
public class HelloSender {
    @Autowired
    AmqpTemplate amqpTemplate;

    public void send(String msg){
        String sendMsg = "hello1 " + new Date();
        System.out.println("Sender1 : " + sendMsg);
        amqpTemplate.convertAndSend("hello", sendMsg);
    }

    public void send2(String msg) {
        String sendMsg = msg + new Date();
        System.out.println("Sender2 : " + sendMsg);
        amqpTemplate.convertAndSend("hello", sendMsg);
    }
}
